import request from '@/utils/request'
import { baseURL } from '@/setting'

// 项目签到相关的请求地址
enum API {
  TEACHER_WS_URL = 'websocket/',
  USERSIGN_URL = 'user/sign',
}

// 创建签到的WebSocket连接
export const createWebSocket = (token: string) => {
  const url = `${baseURL}/${API.TEACHER_WS_URL}${token}`
  const ws = new WebSocket(url)
  return ws
}

// 学生签到
export const userSign = (params: any) => request.get(API.USERSIGN_URL, { params })
